package team.bailan.entity.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;

import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import team.bailan.common.enums.CardTypeEnum;

/**
 * <p>
 * 
 * </p>
 *
 * @author nwh
 * @since 2022-05-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class State implements Serializable {

    private static final long serialVersionUID=1L;

    /**
     * 主键，状态id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 房间号
     */
    private Integer roomId;

    /**
     * 上一个出牌者
     */
    private Integer lastPlayerPosition;

    /**
     * 牌型
     */
    private CardType cardType;

    /**
     * 当前出牌人
     */
    private Integer playerPosition;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 乐观锁
     */
    @Version
    private Integer version;

    public State() {
    }

    public State(Integer roomId, Integer lastPlayerPosition, CardType cardType, Integer playerPosition) {
        this.roomId = roomId;
        this.lastPlayerPosition = lastPlayerPosition;
        this.cardType = cardType;
        this.playerPosition = playerPosition;
    }
}
